package com.heima.user.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.model.admin.pojos.ApUserRealname;
import com.heima.model.common.dtos.ApUserRealnameDto;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.mapper.ApUserRealnameMapper;
import com.heima.user.service.ApUserRealnameService;


import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;



import java.util.List;

@Service
public class ApUserRealnameServiceimp extends ServiceImpl<ApUserRealnameMapper,ApUserRealname> implements ApUserRealnameService {
    @Override
    public ResponseResult rlist(ApUserRealnameDto dto) {
        Page<ApUserRealname> page = new Page<>(dto.getPage(),dto.getSize());

        LambdaQueryWrapper<ApUserRealname> queryWrapper = new LambdaQueryWrapper<>();
        if (dto.getStatus()!=null){
            queryWrapper.eq(ApUserRealname::getStatus,dto.getStatus());
        }
        Page<ApUserRealname> userPage = this.page(page,queryWrapper);

        List<ApUserRealname> records = userPage.getRecords();
        return ResponseResult.okResult(records);
    }
}
